import java.io.FileInputStream;
import java.io.FileNotFoundException;

public class Test{

    public static void func1() throws FileNotFoundException {
        FileInputStream fileInputStream = new FileInputStream("路径");
    }
    public static void main3(String[] args) throws FileNotFoundException{
        try {
            func1();
        }catch (FileNotFoundException e){
            e.printStackTrace();
            System.out.println("捕捉到 FileNotFoundException 异常");
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("捕捉到 NullPointerException 异常");
        }catch (RuntimeException e){
            e.printStackTrace();
            System.out.println("捕捉到 RuntimeException 异常");
        }
        finally {
            System.out.println("after try catch");
        }
    }
    public static void main2(String[] args) {
        try {
            System.out.println(10/0);
//            int[] array = null;
//            System.out.println(array[1]);
//            int[] array = {1,2,3};
//            System.out.println(array[3]);
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("捕捉成功，该异常是空指针异常");
        }catch (ArrayIndexOutOfBoundsException e){
            e.printStackTrace();
            System.out.println("捕捉成功，该异常是数组越界异常");
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("捕捉成功，异常");
        } finally {
            System.out.println("finally执行了");
        }

//        int[] array = new int[]{1,2,3};
//        System.out.println(array[4]);
//
//        int[] array2 = null;
//        System.out.println(array2.length);
//
//        System.out.println(10 / 0);
    }
    public static void main1(String[] args) {
        StringBuffer stringBuffer = new StringBuffer("hello");
        stringBuffer.append(" world");
        StringBuffer del = stringBuffer.delete(0,5);
        System.out.println(del);
        System.out.println(stringBuffer);

        StringBuilder stringBuilder = new StringBuilder("hello");
        stringBuilder.append(" global");
        StringBuilder del2 = stringBuilder.delete(0,5);
        System.out.println(del2);
        System.out.println(stringBuilder);
    }
}
/*public class Test {
    public String toLowerCase(String s) {
        if(s == null){
            return null;
        }
        String ret = "";
        for(int i = 0; i < s.length(); i++){
            //遍历整个字符串
            char ch = s.charAt(i);
            //判断是不是字母
            if(Character.isLetter(ch)){
                //判断是不是小写字母
                if(!Character.isLowerCase(ch)){
                    ch = (char)(ch+32);
                }
            }
            ret += ch;
        }
        return ret;

    }
}*/